package org.example.day20240822.moiveex;

import java.util.ArrayList;
import java.util.List;

public class Customer {
    private String name;
    private List<Record> recordList = new ArrayList<>();

    public Customer(String name) {
        this.name = name;
    }

    public void addRecord(Record record){
        recordList.add(record);
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBillInfo(){
        String result = "-----------------------\n";
        result += "租碟记录---"+this.name+"\n";
        double total_fee = 0;
        double total_score = 0;
        for(Record record : recordList){
            IRent movie = record.getMovie();
            double fee = movie.getFee(record.getRent_days());
            total_fee += fee;
            int score = movie.getScore(record.getRent_days());
            total_score += score;
            result += "\t\t" + movie.getTitle() + "\t" + fee + "\n";
        }
        result+="共消费了 "+total_fee+" 元\n";
        result+="增加了 "+total_score+" 积分\n";
        return result;
    }
}
